package org.nepu.scr.indexrate.converter.drillingrate.keydevice.improvesystem;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.drillingrate.keydevice.improvesystem.NetEmptyHeight;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class NetEmptyHeightConverter implements AttributeConverter<NetEmptyHeight, String> {
    @Override
    public String convertToDatabaseColumn(NetEmptyHeight netEmptyHeight) {
        return JSONUtil.toJsonStr(netEmptyHeight);
    }

    @Override
    public NetEmptyHeight convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, NetEmptyHeight.class);
    }
}
